import http from '@/plugins/aixos'
import { betModel } from '@/types/model'

export const findAllBet = (args = {}) => {
  const url =
    '/bet?' +
    Object.entries(args)
      .map(([key, value]) => `${key}=${value}`)
      .join('&')
  return http.request<betModel[]>({
    url,
    method: 'GET',
  })
}

export const addBet = (data: betModel) => {
  return http.request<betModel>({
    url: '/bet',
    data,
    method: 'POST',
  })
}

export const delBets = async (id: number) => {
  return await http.request({
    url: `/bet/bets/${id}`,
    method: 'DELETE',
  })
}
